const Joi = require('joi')

module.exports = {
   register: Joi.object({
      nickname: Joi.string()
         .required()
         .pattern(/^\S{2,16}$/i)
         .error(new Error('311')),

      password: Joi.string()
         .required()
         .pattern(/^[a-z0-9]{8,16}$/i)
         .error(new Error('312')),

      email: Joi.string()
         .required()
         .email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } })
         .error(new Error('313'))
   }),
   email: Joi.object({
      email: Joi.string()
         .required()
         .email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } })
         .error(new Error('313'))
   })
}